<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>格式化一个 GMT/UTC 日期／时间</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.gettimeofday.html">gettimeofday</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.gmmktime.html">gmmktime</a></div>
 <div class="up"><a href="ref.datetime.html">Date/Time 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.gmdate" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">gmdate</h1>
  <p class="verinfo">(PHP 4, PHP 5)</p><p class="refpurpose"><span class="refname">gmdate</span> &mdash; <span class="dc-title">格式化一个 GMT/UTC 日期／时间</span></p>

 </div>
 <div class="refsect1 unknown-examplet" id="refsect1-function.gmdate-unknown-examplet">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">string</span> <span class="methodname"><strong>gmdate</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$format</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$timestamp</code></span>
  ] )</div>

  <p class="para rdfs-comment">
   同 <span class="function"><a href="function.date.html" class="function">date()</a></span>
   函数完全一样，只除了返回的时间是格林威治标准时（GMT）。例如当在中国（GMT
   +0800）运行以下程序时，第一行显示“Jan 01 2000 00:00:00”而第二行显示“Dec
   31 1999 16:00:00”。
   <div class="example" id="example-2245">
    <p><strong>Example #1 <span class="function"><strong>gmdate()</strong></span> 例子</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">echo&nbsp;</span><span style="color: #0000BB">date</span><span style="color: #007700">(</span><span style="color: #DD0000">"M&nbsp;d&nbsp;Y&nbsp;H:i:s"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">mktime&nbsp;</span><span style="color: #007700">(</span><span style="color: #0000BB">0</span><span style="color: #007700">,</span><span style="color: #0000BB">0</span><span style="color: #007700">,</span><span style="color: #0000BB">0</span><span style="color: #007700">,</span><span style="color: #0000BB">1</span><span style="color: #007700">,</span><span style="color: #0000BB">1</span><span style="color: #007700">,</span><span style="color: #0000BB">2000</span><span style="color: #007700">));<br />echo&nbsp;</span><span style="color: #0000BB">gmdate</span><span style="color: #007700">(</span><span style="color: #DD0000">"M&nbsp;d&nbsp;Y&nbsp;H:i:s"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">mktime&nbsp;</span><span style="color: #007700">(</span><span style="color: #0000BB">0</span><span style="color: #007700">,</span><span style="color: #0000BB">0</span><span style="color: #007700">,</span><span style="color: #0000BB">0</span><span style="color: #007700">,</span><span style="color: #0000BB">1</span><span style="color: #007700">,</span><span style="color: #0000BB">1</span><span style="color: #007700">,</span><span style="color: #0000BB">2000</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    在 PHP 5.1.0 之前，负的时间戳（1970 年之前的日期）在某些系统下（例如
    Windows）不能工作。
   </p>
  </p></blockquote>
  <p class="para">
   参见 <span class="function"><a href="function.date.html" class="function">date()</a></span>，<span class="function"><a href="function.mktime.html" class="function">mktime()</a></span>，<span class="function"><a href="function.gmmktime.html" class="function">gmmktime()</a></span>
   和 <span class="function"><a href="function.strftime.html" class="function">strftime()</a></span>。
  </p>
 </div>

</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.gettimeofday.html">gettimeofday</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.gmmktime.html">gmmktime</a></div>
 <div class="up"><a href="ref.datetime.html">Date/Time 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
